package com.yuanxiao.common.api.feign;

import com.yuanxiao.common.api.entity.SysLogEntity;
import com.yuanxiao.common.api.feign.fallback.SysServerFeignFallbackClient;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;
import com.yuanxiao.common.core.result.R;

//@FeignClient(value = "lzsh-system", fallback = SysLogFeignFallbackClient.class)
@FeignClient(value = "lzsh-system", url = "http://localhost:53021", fallback = SysServerFeignFallbackClient.class)
@Qualifier("sysServerFeignClient")
public interface SysServerFeignClient {

    @PostMapping("/sys/log/save")
    R saveLog(@RequestBody SysLogEntity log);

    @GetMapping("/sys/user/info/{userId}")
    R getUserByUserId(@PathVariable("userId") Long userId);

    @GetMapping("/sys/user/info/{userId}")
    R getUserByUserId(@PathVariable("userId") Long userId, @RequestParam("serverRequest") String serverRequest);

    @PostMapping("/sys/user/check/handlepwd/{userId}/{handlePwd}")
    R checkHandlepwd(@PathVariable("userId") Long userId, @PathVariable("handlePwd") String handlePwd);

    @GetMapping("/sys/dept/info/{deptId}")
    R getDeptById(@PathVariable("deptId") Long deptId);

    @GetMapping("/sys/server/call/feign/cfg/handel/list")
    R handelFeignCallList(
            @RequestParam("serverCode") String serverCode,
            @RequestParam("usedType") String usedType,
            @RequestParam("bizCode") String bizCode
    );
}
